#ifndef PARAMETERDICTIONARY_H
#define PARAMETERDICTIONARY_H

#include "Framework/Prerequisites.h"


#include "Framework/ScriptParser/Parameter.h"
#include "Framework/ScriptParser/ParameterCommand.h"

namespace tyro
{
	namespace Framework
	{
		typedef vector<Parameter>::type ParameterList;
		typedef map<String, ParameterCommand* >::type ParameterCommandMap;

		class ParameterDictionary
		{

			friend class ScriptInterface;

		
		protected:

			// Parameter definitions
			ParameterList parametersDefs;

			// Parameter command objects
			ParameterCommandMap parameterCommands;

			// Retrieve the command object for a named parameter
			ParameterCommand* GetParameterCommand(const String& name)
			{
				ParameterCommandMap::iterator itr = parameterCommands.find(name);
				if (itr != parameterCommands.end())
				{
					return itr->second;
				} 
				else
				{
					return 0;
				}
			}

			// Retrieve the command object for a named parameter
			const ParameterCommand* GetParameterCommand(const String& name) const
			{
				ParameterCommandMap::const_iterator itr = parameterCommands.find(name);
				if (itr != parameterCommands.end())
				{
					return itr->second;
				} 
				else
				{
					return 0;
				}
			}

		public:

			ParameterDictionary() {}

			// Add a parameter command to the dictionary
			void AddParameter(const Parameter& parameter, ParameterCommand* command)
			{
				parametersDefs.push_back(parameter);
				parameterCommands[parameter.name] = command;
			}

			// Retrieve parameter list
			const ParameterList& GetParameterList(void) const
			{
				return parametersDefs;
			}

		private:
		};

	}
}
#endif